package com.douwong.student.base;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Window;
import android.view.WindowManager;

import com.douwong.student.model.TeacherOnline;
import com.douwong.student.utils.LogUtils;

import java.util.List;

import rx.Subscription;

public abstract class BaseActivity extends AppCompatActivity {
    private static final String TAG = "BaseActivity";
    protected Subscription subscription;
    private List<TeacherOnline> mTeacherOnlineList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //取消标题
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        //取消状态栏
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        initView();
        initData();
        initEvent();
    }

      @Override
    protected void onDestroy() {
        super.onDestroy();
        unsubscribe();
    }


    protected void unsubscribe() {
        if (subscription != null && !subscription.isUnsubscribed()) {
            subscription.unsubscribe();
        }
    }


    /**
     * 初始化事件
     */
    protected  void initEvent(){

    };

    /**
     * 初始化数据
     */
    protected void initData() {
       // View
    }

    /**
     * 出事化View
     */
    protected abstract void initView() ;
    /**
     * 通用log信息
     * @param str
     */
    protected void logcatI(String str){
        LogUtils.i(this.getClass().getSimpleName(),str);
    }

}
